import { getPlayListComment } from "@/api/comment";
import { Comment } from "@/types/comment";
import { ref } from "vue";

export function usePlayListComment() {
  const playlistCommentData = ref<{
    cnum: number;
    code: number;
    commentBanner: any;
    comments: Comment[];
    hotComments: Comment[];
    isMusician: boolean;
    more: boolean;
    topComments: Comment[];
    total: number;
    userId: number;
  } | null>(null);

  const queryPlaylistComment = (params: {
    id: number | string;
    limit: number;
    offset: number;
  }) => {
    getPlayListComment(params).then((res) => {
      console.log(res);
      if (res.code === 200) {
        playlistCommentData.value = res;
      }
    });
  };

  return { playlistCommentData, queryPlaylistComment };
}
